<?php


namespace app\api\controller;

use app\common\controller\Api;
use think\console\command\optimize\Schema;
use think\Db;

/**
 * 流程
 */
class Ziliao extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = ['*'];


    public function getallcat(){


        $list=Db::name('ziliao')->order('weigh desc')->select();

        foreach ($list as &$ke){

            $ke['image']=cdnurl($ke['image'],true);

        }

        $this->success('请求成功',$list);


    }

    //查询资料列表
    public function getlistbydcateid(){

        $id=$this->request->param('id');
        $key=$this->request->param('key');

        $map['ziliao_cate_id']=['eq',$id];

        if ($key){
            $map['name']=['like','%'.$key.'%'];
        }

        $list=Db::name('ziliao_c')->where($map)->order('weigh desc')->select();

        foreach ($list as &$ke){
            $ke['image']=cdnurl($ke['image'],true);
        }

        $this->success('请求成功',$list);

    }

    /**
     * 资料详情
     */

    public function getinfobyid(){

        $user=$this->auth->getUser();
        $id=$this->request->param('id');

        $find=Db::name('ziliao_c')->where(['id'=>$id])->find();

        $find['v_link']=cdnurl($find['file'],true);

        $this->success('操作成功',$find);
    }

















}